home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / n_b_v203.zip / GETATTR.DMO < prev    next >
Text File  |  1996-07-04  |  3KB  |  66 lines

  1. $if 0
  2.     ┌──────────────────────────╖                        PowerBASIC v3.20
  3.  ┌──┤          DASoft          ╟──────────────────────┬──────────────────╖
  4.  │  ├──────────────────────────╢    Copyright 1995    │ DATE: 1995-10-01 ╟─╖
  5.  │  │ FILE NAME   GETATTR .DMO ║          by          ╘════════════════─ ║ ║
  6.  │  │                          ║  Don Schullian, Jr.                     ║ ║
  7.  │  ╘══════════════════════════╝                                         ║ ║
  8.  │ A license is hereby granted to the holder to use this source code in  ║ ║
  9.  │ any program, commercial or otherwise,  without receiving the express  ║ ║
  10.  │ permission of the copyright holder and without paying any royalties,  ║ ║
  11.  │ as long as this code is not distributed in any compilable format.     ║ ║
  12.  │  IE: source code files, PowerBASIC Unit files, and printed listings   ║ ║
  13.  ╘═╤═════════════════════════════════════════════════════════════════════╝ ║
  14.    │                ....................................                   ║
  15.    ╘═══════════════════════════════════════════════════════════════════════╝
  16. $endif
  17.  
  18. '.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
  19. ' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
  20.  
  21. $INCLUDE "DAS-NB02.INC"
  22.  
  23. COLOR 7, 0
  24. CLS
  25.  
  26. ? "┌──────────────────────────────────────────────────────────────────────
  27. ? "│ fGetAttrib? ( FileSpec$ )
  28. ? "├──────────────────────────────────────────────────────────────────────
  29. ? "│ Unlike PowerBASIC's FILEATTR, this function does NOT require that the
  30. ? "│ file in question be open, nor will it cause an error if the file is
  31. ? "│ not found! It simply returns a -1 if you attempt to send it trash or
  32. ? "│ if the file has been purloined!
  33. ? "│ The tests below may need some tweaking to get them all to work on
  34. ? "│ your system but its good practice d:)
  35. ? "│ RETURNS: -1 = file not found    0 = regular file
  36. ? "│           1 = read only         8 = volume label
  37. ? "│           2 = hidden           16 = directory
  38. ? "│           4 = system           32 = archive file
  39. ? "└──────────────────────────────────────────────────────────────────────
  40. ?                              '┌─────────────────────────────────────────
  41. Path$ = "DMO\"                 '│ pick a path
  42.                                '│
  43. F$ = Path$ + "NOTTHERE.XXX"    '│ this file isn't there
  44. PRINT F$; TAB(25);             '│   returns a -1
  45. PRINT fGetAttrib%( F$ )        '│
  46.                                '│
  47. F$ = Path$ + "GETATTR.DMO"     '│ this file an archive file
  48. PRINT F$; TAB(25);             '│   returns a 32
  49. PRINT fGetAttrib%( F$ )        '│
  50.                                '│
  51. F$ = "*.*"                     '│ wild cards don't work either
  52. PRINT F$; TAB(25);             '│   returns a -1
  53. PRINT fGetAttrib%( F$ )        '│
  54.                                '│
  55. F$ = Path$                     '│ just a path so
  56. PRINT F$; TAB(25);             '│   returns a 16
  57. PRINT fGetAttrib%( F$ )        '│
  58.                                '│
  59. F$ = "C:\IBMBIO.COM"           '│ this is a system, hidden and read only file
  60. PRINT F$; TAB(25);             '│   returns 7   ( 1, 2 and 4 )
  61. PRINT fGetAttrib%( F$ )        '│
  62.                                '│
  63. F$ = "C:\"                     '│ another path
  64. PRINT F$; TAB(25);             '│   so, another 16
  65. PRINT fGetAttrib%( F$ )        '│
  66.